﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Verse.PawnCapacityUtility;
using Verse;
using HarmonyLib;

namespace SZ.Mech
{
    [HarmonyPatch(typeof(PawnCapacityUtility), "CalculateCapacityLevel")]
    public static class PawnCapacityUtility_Patch
    {
        /// <summary>
        /// 后缀
        /// </summary>
        /// <param name="__result"></param>
        /// <param name="diffSet"></param>
        /// <param name="capacity"></param>
        /// <param name="impactors"></param>
        /// <param name="forTradePrice"></param>
        public static void Postfix(ref float __result, HediffSet diffSet, PawnCapacityDef capacity, List<CapacityImpactor> impactors = null, bool forTradePrice = false)
        {
            CapacityIgnoreExtension capacityIgnoreExtension = diffSet.pawn.def.GetModExtension<CapacityIgnoreExtension>();// 能力状态忽略
            if (capacityIgnoreExtension!=null)
            {
                if (__result < 1)
                {
                    __result = 1;//直接属性返回1
                }
            }
        }
    }
}
